<html>
	<script type="text/javascript">
		var tramites = function () {
		var x = 0;    
		
		return {
			pepe: function(){
				return x++;
				}
			};
		};

		var x = tramites();


		for(var i=0;i<10; i++){
			console.log(x.pepe());
		}
		
		var y = tramites();
		console.log(y.pepe());
		
	</script>
</html>